# Contributor: Alex Yam <alex@alexyam.com>
# Maintainer: Sadie Powell <sadie@witchery.services>
pkgname=inspircd
pkgver=4.4.0
pkgrel=0
pkgdesc="internet relay chat daemon (ircd)"
url="https://www.inspircd.org/"
pkgusers="inspircd"
pkggroups="inspircd"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	argon2-dev
	gnutls-dev
	libpq-dev
	mariadb-dev
	openldap-dev
	pcre2-dev
	perl
	re2-dev
	sqlite-dev
	yyjson-dev
	"
subpackages="$pkgname-doc"
options="!check" # no test suite
source="$pkgname-$pkgver.tar.gz::https://github.com/inspircd/inspircd/archive/v$pkgver.tar.gz"

# secfixes:
#   3.10.0-r0:
#     - CVE-2021-33586

build() {
	./configure \
		--enable-extras "argon2 ldap log_json log_syslog mysql pgsql regex_pcre2 regex_posix regex_re2 sqlite3 ssl_gnutls sslrehashsignal"
	./configure \
		--binary-dir /usr/bin \
		--data-dir /var/lib/inspircd/data \
		--example-dir /usr/share/inspircd/examples \
		--module-dir /usr/lib/inspircd/modules \
		--script-dir /usr/lib/inspircd/scripts \
		--disable-auto-extras \
		--distribution-label alpine$pkgrel \
		--gid inspircd \
		--uid inspircd \
		--system
	INSPIRCD_DISABLE_RPATH=1 make
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
242f02ffea0c9913847dc30ca8114ad10b5739de800a03f010d00c9fe9b68e99ed6c997b5bf6f6b9f85d5de28d35aa3118d58b2e38d0dc69d1ae82a539b172ac  inspircd-4.4.0.tar.gz
"
